package com.nulldev.util.web.npswitcher;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.TrayIcon;

import javax.imageio.ImageIO;

import com.nulldev.util.image.ImageUtil;
import com.nulldev.util.io.FileUtil;
import com.nulldev.util.java.swing.extSwing.lookandfeel.themes.ThemeApplier;
import com.nulldev.util.java.swing.font.FontManager;

public class nProxySwitcherTray extends TrayIcon {

	public nProxySwitcherTray() throws Exception {
		super(ImageUtil.createFromColorRndImg(32, 32), "nProxySwitcher\nCurrent Status: UNSECURED", 
				new PopupMenu("Configurator"));
		this.INSTANCE = this;
		this.getPopupMenu().setFont(FontManager.getFontSet());
		this.setImageAutoSize(false);
	}
	
	private static nProxySwitcherTray INSTANCE;
	public static nProxySwitcherTray createInstance() throws Exception {
		final nProxySwitcherTray tray = new nProxySwitcherTray();
		tray.setImage(ImageIO.read(FileUtil.getResourceAsFile(nProxySwitcherTray.class, "/com/nulldev/util/web/npswitcher/secured.png")));
		return tray;
	}
}
